package entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "Message")
public class Message implements Serializable {

    private Long id_message;
    private String txt;
    private Utilisateur auteur;
    private Tache tache;
    private Date dateCreation;

    public Message() {
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getId() {
        return id_message;
    }

    public void setId(Long id_message) {
        this.id_message = id_message;
    }

    @Column(name = "TXT", nullable = false, updatable = false)
    public String getTxt() {
        return txt;
    }

    public void setTxt(String txt) {
        this.txt = txt;
    }

    @JoinColumn(name = "AUTEUR", nullable = false, updatable = false)
    @ManyToOne
    public Utilisateur getAuteur() {
        return auteur;
    }

    public void setAuteur(Utilisateur auteur) {
        this.auteur = auteur;
    }

    @JoinColumn(name = "TACHE", nullable = false, updatable = false)
    @ManyToOne
    public Tache getTache() {
        return tache;
    }

    public void setTache(Tache tache) {
        this.tache = tache;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "DATE_CREATION", nullable = false)
    public Date getDateCreation() {
        return dateCreation;
    }

    public void setDateCreation(Date dateCreation) {
        this.dateCreation = dateCreation;
    }

}
